local skel = fk.CreateSkill {
  name = "lb__zhuoniang",
}

Fk:loadTranslationTable {
  ["lb__zhuoniang"] = "灼酿",
  [":lb__zhuoniang"] = "出牌阶段限一次，你可以对一名角色造成1点火焰伤害，该角色于你的下个准备阶段回复2点体力。",

  ["@@lb__zhuoniang"] = "灼酿",
  ["#lb__zhuoniang__trigger"] = "灼酿",
  ["#lb__zhuoniang"] = "灼酿：你可以对一名角色造成1点火焰伤害，其于你的下个准备阶段回复2点体力",

  ["$lb__zhuoniang1"] = "从你开始吧。 ",
  ["$lb__zhuoniang2"] = "瞧着点。",
}

skel:addEffect("active", {
  prompt = "#lb__zhuoniang",
  anim_type = "offensive",
  can_use = function(self, player)
    return player:usedSkillTimes(skel.name, Player.HistoryPhase) == 0
  end,
  card_filter = Util.FalseFunc,
  min_target_num = 1,
  target_filter = function(self, player, to_select, selected, selected_cards)
    return #selected == 0
  end,
  on_use = function(self, room, effect)
    local t = effect.tos[1]
    room:addPlayerMark(t, "@@lb__zhuoniang", 1)
    room:damage {
      from = effect.from,
      to = t,
      damage = 1,
      damageType = fk.FireDamage,
      skillName = skel.name,
    }
  end,
})

skel:addEffect(fk.EventPhaseStart, {
  is_delay_effect = true,
  anim_type = "support",
  can_trigger = function(self, event, target, player, data)
    if player:hasSkill("lb__zhuoniang") and player == target and player.phase == Player.Start then
      local ps = {}
      for _, p in ipairs(player.room:getAllPlayers()) do
        if p:getMark("@@lb__zhuoniang") > 0 then
          if p.dead then
            player.room:setPlayerMark(p, "@@lb__zhuoniang", 0)
          else
            table.insert(ps, p)
          end
        end
      end
      event:setCostData(self, { tos = ps })
      return #ps > 0
    end
  end,
  on_cost = Util.TrueFunc,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local tos = event:getCostData(self).tos
    for _, p in ipairs(tos) do
      room:recover {
        who = p,
        num = p:getMark("@@lb__zhuoniang") * 2,
        skillName = "lb__zhuoniang",
        recoverBy = player,
      }
      room:setPlayerMark(p, "@@lb__zhuoniang", 0)
    end
  end,
})

return skel
